<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <span ref="abc">abc</span>

      <input type="button" value="事件-关联方法" v-on:click="handle" />
    </div>

    <script src="../lib/vue.js"></script>
    <script src="../lib/axios.min.js"></script>

    <script>
      let vm = new Vue({
        el: '#app',
        data: {
          counter: 0,
        },
        methods: {
          handle: function () {
            let span = this.$refs.abc
            // 为给定 ID 的 user 创建请求
            axios
              .get(
                'http://wthrcdn.etouch.cn/weather_mini?city=%E7%8F%A0%E6%B5%B7'
              )
              .then(function (response) {
                console.log(response)
                span.innerHTML = response
              })
              .catch(function (error) {
                console.log(error)
              })
          },
        },
      })
    </script>
  </body>
</html>
